import requests from './requests'

export const loginAPI=(loginInfo)=>{
    return requests({
        url:'/api/login',
        method:'post',
        data:loginInfo
    })
}

export const registerAPI=(userInfo)=>{
    return requests({
        url:'/api/register',
        method:'post',
        data:userInfo
    })
}

export const writeArticleAPI=(article)=>{
    return requests({
        url:'/addArticle',
        method:'post',
        data:article
    })
}

export const getMyArticlesAPI=()=>{
    return requests({
        url:`/getMyArticles`,
        method:'get'
    })
}

export const getAllArticleAPI=()=>{
    return requests({
        url:'/api/getAllArticle',
        method:'get'
    })
}

export const getClassifyAPI=()=>{
    return requests({
        url:'/api/getClassify',
        method:'get'
    })
}

export const getclassifyArticlesAPI=(about)=>{
    return requests({
        url:`/api/getclassifyArticles?about=${about}`,
        method:'get'
    })
}

export const getOneArticleAPI=(id)=>{
    return requests({
        url:`/api/getOneArticle?id=${id}`,
        method:'get'
    })
}